package com.learning.controller.teacher;

import java.util.List;

import javax.annotation.Resource;

import com.learning.dto.GradeDTO;
import com.learning.result.Result;
import com.learning.service.IAnswerPaperService;
import com.learning.vo.AnswerPaperFinishedVO;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController("teacherAnswerPaperController")
@RequestMapping("/teacher")
public class AnswerPaperController {

	@Resource
	private IAnswerPaperService iAnswerPaperService;

	@PostMapping("/check/{answerPaperId}")
	public Result<String> checkAnswerPaper(@PathVariable Long answerPaperId, @RequestBody List<GradeDTO> gradeList) {
		return Result.success(iAnswerPaperService.checkAnswerPaper(answerPaperId, gradeList));
	}

	@GetMapping("/check")
	public Result<List<AnswerPaperFinishedVO>> getAnswerPapers() {
		return Result.success(iAnswerPaperService.getAnswerPapers());
	}
}
